/*
 * Project Name: jmax
 * File Name: Park.java
 * Copyright: Copyright(C) 1985-2015 ZKTeco Inc. All rights reserved.
 */
package com.xdtech.parking.protocol.vo;

import java.util.List;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

import com.xdtech.parking.vo.DeviceStatuInfo;

/**
 * max.zheng
 * @version TODO 添加版本
 * @see 相关类或方法，不需要请删除此行
 * @since 2015-6-18 下午5:15:57
 */
//{"aid"："a1"，"gwid"："f0001","ukid": "a0101”,“tag”:“ulock”, “st”:{ “on-off”:0,“kwh”:1, “car”:0}}
public class ParkDeviceInfo
{
	private String aid;
	
	private String gwid;
	
	private String ukid;
	
	private String tag;
	
	private String ask;
	
	private DeviceStatuInfo st;

	public String getAid()
	{
		return aid;
	}

	public void setAid(String aid)
	{
		this.aid = aid;
	}

	public String getGwid()
	{
		return gwid;
	}

	public void setGwid(String gwid)
	{
		this.gwid = gwid;
	}

	public String getUkid()
	{
		return ukid;
	}

	public void setUkid(String ukid)
	{
		this.ukid = ukid;
	}

	public String getTag()
	{
		return tag;
	}

	public void setTag(String tag)
	{
		this.tag = tag;
	}

	public DeviceStatuInfo getSt()
	{
		return st;
	}

	public void setSt(DeviceStatuInfo st)
	{
		this.st = st;
	}

	public String getAsk() {
		return ask;
	}

	public void setAsk(String ask) {
		this.ask = ask;
	}
	
	public static String returnUnknownDevice(List<ParkDeviceInfo> parkDeviceInfos) {
//		[{"tag":"ulock","aid":"a1","gwid":"f0001","ukid":"123456","error":1},{"tag":"ulock","aid":"a1","gwid":"f0001","ukid":"123457","error":1}]
		JSONArray json = new JSONArray();
		for (ParkDeviceInfo parkDeviceInfo : parkDeviceInfos) {
			JSONObject jsonObject = new JSONObject();
			jsonObject.put("tag", parkDeviceInfo.getTag());
			jsonObject.put("aid", parkDeviceInfo.getAid());
			jsonObject.put("gwid", parkDeviceInfo.getGwid());
			jsonObject.put("ukid", parkDeviceInfo.getUkid());
			jsonObject.put("error", 1);
			json.add(jsonObject);
		}
		return json.toString();
		
		
	}
	
}
